using System;
using System.Windows.Forms;
using DataTreeLib;

namespace LiveSequence.Common.Tree
{
    public class ImageTreeNodeMapper<T,ST> : ITreeNodeMapper where T : ITreeItem<ST>
    {
        public void UpdateNode(object dataNode, TreeNode treeNode)
        {
            DTreeNode<T> dn = (DTreeNode<T>)dataNode;
            treeNode.Tag = dn;
            treeNode.Text = dn.Value.ToString();
            treeNode.ImageIndex = Convert.ToInt32(dn.Value.SelectionType); //treeNode.Level;
            treeNode.SelectedImageIndex = Convert.ToInt32(dn.Value.SelectionType);
        }

        public object GetNodeInfo(TreeNode treeNode)
        {
            return treeNode.Tag;
        }

        #region ITreeNodeMapper Members


        public ContextMenuStrip GetContextMenuStrip(TreeNode treeNode)
        {
          return null;
        }

        #endregion
    }
}
